`<template>
  <el-dialog class="el-dialog" title="修改项目" v-model="dialogFormVisible" :append-to-body="append">
    <el-form :model="project">
      <el-form-item label="名称" :label-width="formLabelWidth">
        <el-input v-model="project.name" placeholder="请输入名称" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="详情" :label-width="formLabelWidth">
        <el-input placeholder="请输入排序" v-model="project.details"></el-input>
      </el-form-item>
      <el-form-item label="负责部门" :label-width="formLabelWidth">
        <el-select v-model="project.departmentId">
          <template v-for="department in departments" :key="department.id">
            <el-option :label="department.name" :value="department.id"></el-option>
          </template>
        </el-select>
      </el-form-item>
      <el-form-item label="开始时间" :label-width="formLabelWidth">
        <div class="block">
          <el-date-picker v-model="project.startTime" format="YYYY/MM/DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" :placeholder="project.startTime">
          </el-date-picker>
        </div>
      </el-form-item>
      <el-form-item label="预计结束" :label-width="formLabelWidth">
        <div class="block">
          <el-date-picker v-model="project.estTime" format="YYYY/MM/DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" :placeholder="project.estTime">
          </el-date-picker>
        </div>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogFormVisible = false">取 消</el-button>
      <el-button type="primary" @click="submitForm()">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import instanceToken from "@/utlis/tokenIdentify.js";
export default {
  name: 'EditProject',
  components: {},
  data() {
    return {
      dialogFormVisible: false,
      append: true,
      project: {
        name:'',
        department:{
          name: '',
        },
        departmentId:'',
        startTime: '',
        estTime: '',
        details: '',
        companyUserId:'',
        companyId: '',
      },
      userId:'',
      departments: [],
      formLabelWidth: '120px'
    };
  },
  created() {
  },
  methods: {
    initdata(id,row){
      instanceToken.get("project/leader/editInitData/"+id).then(res1 =>{
        this.project = res1.data.data;
        instanceToken.get("project/leader/initDepartment").then(res2 =>{
          this.departments = res2.data.data;
        })
      })
    },
    submitForm(){
      instanceToken.post("project/leader/editProject",this.project).then(res =>{
        this.$parent.$parent.initData();
        this.$alert('修改成功', '修改', {
          confirmButtonText: '确定',
        });
        this.close();
      })
    },
    show() {
      this.dialogFormVisible = true;
    },
    close() {
      this.dialogFormVisible = false;
    }
  },

}
</script>

<style>
.el-dialog {
  width: 500px;
}
</style>
`